<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>选择上传excel</title>
<link rel="stylesheet" href="./static/bootstrap-fileinput-5.0.4/css/fileinput.css" />
    <link rel="stylesheet" href="./static/bootstrap-3.3.7/css/bootstrap.min.css" >
	<script type="text/javascript" src="./static/js/jquery-1.12.4.min.js"></script>
	<script type="text/javascript" src="./static/bootstrap-3.3.7/js/bootstrap.min.js"></script>
    <script type="text/javascript" src="./static/bootstrap-fileinput-5.0.4/js/fileinput.js"></script>
</head>
<body>
<form action="" method="post" >
<input id="uploadFile" type="file" name='file'class='file' accept=".xls,.xlsx" 
data-show-upload="false" data-show-cancel="false" data-show-preview="false" >
<button type="submit" id="upload">确定提交</button>
</form>
<script type="text/javascript">
$("#upload").click(function(){
	var formData = new FormData();
	if($("#uploadFile")[0].files[0]!=null){
	formData.append("files", $("#uploadFile")[0].files[0]);
	$.ajax({
		url:"/app/upload",
		type:'POST',
		data:formData,
		processData : false,
        contentType : false,
        dataType: "json",
        success: function (data) {
            debugger;
            if (200 == data.code) {
            
            } else {
           
            }}});
	}else{
		alert("请选择文件后再提交");
	}
});
</script>
</body>
</html>